<template>
	<view class="wrapper">
		<view class="user_head_box">
			<dimg :src="userinfo.userId | avatar" mode="" class="user_head"></dimg>
			<view class="user_name">{{userinfo.nickname}}</view>
		</view>
		<input type="text" v-model="account" placeholder="输入通讯号" class="com_nub" placeholder-class="f30" />
		<view class="tips">通讯号是账号的唯一凭证，只能设置一次</view>
		<button type="primary" class="sub" @tap="updateUser">确定</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			userinfo: '',
			account:''
		};
	},
	onLoad() {
		this.userinfo = uni.getStorageSync('userinfo');
	},
	methods: {
		updateUser() {
			this.$ajax(this.apiList.userUpdate, {
				account: this.account
			}).then(res => {
				this.userinfo.account=this.account
				uni.setStorageSync('userinfo', this.userinfo);
				this.$sToast('设置成功')
				this.$back(1,1500)
			});
		}
		
	}
};
</script>

<style>
.wrapper {
	background-color: #f3f3f3;
}
.user_head_box {
	display: flex;
	flex-direction: row;
	align-items: center;
	height: 249rpx;
	background: rgba(255, 255, 255, 1);
	border-bottom: 1rpx solid rgba(224, 224, 224, 1);
}
.user_head {
	width: 120rpx;
	height: 120rpx;
	border-radius: 50%;
	margin: 0 30rpx 0 30rpx;
	overflow: hidden;
}
.user_name {
	font-size: 32rpx;
	font-weight: bold;
	color: rgba(51, 51, 51, 1);
}
.com_nub {
	height: 102rpx;
	background: rgba(255, 255, 255, 1);
	border-bottom: 1rpx solid rgba(224, 224, 224, 1);
	border-top: 1rpx solid rgba(224, 224, 224, 1);
	padding-left: 31rpx;
	margin-top: 20rpx;
}
.tips {
	font-size: 26rpx;
	line-height: 26rpx;
	font-weight: 500;
	color: rgba(102, 102, 102, 1);
	margin: 20rpx 0 29rpx 31rpx;
}
.sub {
	width: 710rpx;
	height: 80rpx;
	background: rgba(2, 151, 254, 1);
	border-radius: 4rpx;
	font-size: 30rpx;
	font-weight: 500;
	color: rgba(255, 255, 255, 1);
}
</style>
